//package cc.magicjson.example.demo.virtual;
//
//import java.util.concurrent.ExecutionException;
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//import java.util.concurrent.Future;
//import java.util.function.Function;
//
//public class VirtualThreadExample {
//
//    private static final ThreadLocal<Object> threadLocal = new ThreadLocal<>();
//
//    public static void main(String[] args) throws ExecutionException, InterruptedException {
//        VirtualThreadManager manager = VirtualThreadManager.INSTANCE;
//
//        // 设置自定义线程池
//        ExecutorService customExecutor = Executors.newFixedThreadPool(10);
//        manager.setExecutor(customExecutor);
//
//        // 设置ThreadLocal值
//        threadLocal.set("Main thread value");
//
//        // 定义任务
//        Function<ThreadLocal<Object>, String> task = (local)
//                -> "ThreadLocal value: " + local.get();;
//
//        // 执行任务
//        Future<String> future = manager.execute(task, threadLocal);
//
//        // 获取任务结果
//        System.out.println("任务结果: " + future.get());
//
//        // 关闭线程池
//        manager.shutdown();
//    }
//}
